<div class="table_con">
	<table>
    	<tr class="tb_title">
        	<td style="width:5%" >序号</td>
        	<td style="width:10%">博客类型</td>
        	<td style="width:30%">博客标题</td>
        	<td style="width:8%">点击量</td>
            <td style="width:10%">创建日期</td>
            <td style="width:10%">当前状态</td>
            <td>操作</td>
        </tr>
        <#list articleList as article>
	        <tr id="art_${article.id?if_exists}">
	        	<td style="width:5%" >${article_index+1}</td>
	            <td style="width:10%"><#if article.articleType==1>程序人生<#elseif article.articleType==2>思维天地</#if></td>
	            <td style="width:30%">${article.title?if_exists}</td>
	            <td style="width:8%">${article.unitAccess.accessSum?if_exists}</td>
	            <td style="width:10%">${article.createDate?if_exists}</td>
	            <td style="width:10%"><#if article.visible==1>可见<#elseif article.visible==0>不可见</#if></td>
	            <td>
	                <input class="btn btn-info" type="button" onclick="preEditArtlcleFn('${article.id}');" value="编辑" />
	                <#if article.visible ==1>
	                	<input class="btn btn-warning" type="button" onclick="hideOrRemoveArtlcle('${article.id}',1,0);" value="隐藏" />
	                <#elseif article.visible ==0>
						<input class="btn btn-success" type="button" onclick="hideOrRemoveArtlcle('${article.id}',1,1);" value="恢复" />	                
	                </#if>
	                <input class="btn btn-danger" type="button" onclick="hideOrRemoveArtlcle('${article.id}',2,1);" value="删除" />
	            </td>
	        </tr>
        </#list>
    </table>
	
	<#if (articleList?size = 0)>
	  	<center>	
	  		<br/>
	  		暂无记录
		</center>
	</#if>
	
</div>
<script>
var preEditArtlcleFn = function(id){
		
	$.ajax({
		url:'${request.contextPath}/article/preEditarticle.htm',
		type:'post',
		async:'false',
		cache:false,
		processData:true,
		data:{
			'id':id
		},
		success:function(html)
		{
			$('#art').html(html);
			$('#articleModal').modal();
		}
	});
}

var hideOrRemoveArtlcle = function(id,type,action){
 	if(!confirm('确认操作么？'))
 		return false;
	$.ajax({
		url:'${request.contextPath}/article/hideOrRemoveArtlcle.htm',
		type:'post',
		async:'false',
		cache:false,
		processData:true,
		dataTpye:'json',
		data:{
			'id':id,
			'type':type,
			'action':action
		},
		success:function(json)
		{
			alert(json.msg);
			searchData();
		}
	});
}
</script>

<#include "common/admin_paging.ftl">
